package ruru.client.ui.widgets.sortableTable;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;

public class LastRaidDate implements Comparable {
	private final Date date;
	private final DateTimeFormat lastRaidFormat = DateTimeFormat.getFormat("EEE MM-dd-yyyy");
	
	// public final static Date defaultStart = new Date(946713600734l);
	
	public LastRaidDate(Date date) {
		this.date = new Date(date.getTime());
	}
	
	/**
	 * Returns an empty string if the Date is a new Date(0l) i.e. uninitialized.
	 */
	public String toString() {
		if(date.equals(new Date(0l))) {
			return "";
		}
		return lastRaidFormat.format(date);
	}
	
	public Date getDate() {
		return new Date(date.getTime());
	}

	public int compareTo(Object arg0) {
		LastRaidDate lrd = (LastRaidDate) arg0;
		return date.compareTo(lrd.getDate());
	}
}